﻿using System;
using System.Collections.Generic;
using MartinsEssentials.MVVM;

namespace MyAnimelistRecommender.DataObject
{
    public class RecommendationGroup : ViewModelBase
    {
        private double _CalcedVotes;

        private List<string> _Genres = new List<string>();

        private string _Image;

        private bool _IsEnglish = false;

        private List<string> _Langs;

        private int _MaxRecs;

        private string _MemberScore;

        private string _Name;

        private int _Place;

        private string _Rank;

        private Dictionary<string, int> _RecNamesAndScore;

        private int _Sources;

        private string _Uri;

        private int _Votes;

        public RecommendationGroup()
        {
            Genres = new List<string>();
            Rank = "-";
            MemberScore = "-";
        }

        public int Aid { get; set; }

        public double CalcedVotes
        {
            get
            {
                return _CalcedVotes;
            }
            set
            {
                if (value != _CalcedVotes)
                {
                    _CalcedVotes = value;
                    OnPropertyChanged("CalcedVotes");
                }
            }
        }

        public List<string> Genres
        {
            get
            {
                return _Genres;
            }
            set
            {
                if (value != _Genres)
                {
                    _Genres = value;
                    OnPropertyChanged("Genres");
                }
            }
        }

        public string Image
        {
            get
            {
                return _Image;
            }
            set
            {
                if (value != _Image)
                {
                    _Image = value;
                    OnPropertyChanged("Image");
                }
            }
        }

        public bool IsEnglish
        {
            get
            {
                return _IsEnglish;
            }
            set
            {
                if (value != _IsEnglish)
                {
                    _IsEnglish = value;
                    OnPropertyChanged("IsEnglish");
                }
            }
        }

        public List<string> Langs
        {
            get
            {
                return _Langs;
            }
            set
            {
                if (value != _Langs)
                {
                    _Langs = value;
                    OnPropertyChanged("Langs");
                }
            }
        }

        public string LangString
        {
            get
            {
                string temp = "-";
                if (Langs != null)
                {
                    if (Langs.Count > 0)
                        temp = Langs[0];
                    for (int i = 1; i < Langs.Count; i++)
                    {
                        temp += ", " + Langs[i];
                    }
                }

                return temp;
            }
        }

        public int MaxRecs
        {
            get
            {
                return _MaxRecs;
            }
            set
            {
                if (value != _MaxRecs)
                {
                    _MaxRecs = value;
                    OnPropertyChanged("MaxRecs");
                }
            }
        }

        public string MemberScore
        {
            get
            {
                return _MemberScore;
            }
            set
            {
                if (value != _MemberScore)
                {
                    _MemberScore = value;
                    OnPropertyChanged("MemberScore");
                }
            }
        }

        public string Name
        {
            get
            {
                return _Name;
            }
            set
            {
                if (value != _Name)
                {
                    _Name = value;
                    OnPropertyChanged("Name");
                }
            }
        }

        public int Place
        {
            get
            {
                return _Place;
            }
            set
            {
                if (value != _Place)
                {
                    _Place = value;
                    OnPropertyChanged("Place");
                }
            }
        }

        public string Rank
        {
            get
            {
                return _Rank;
            }
            set
            {
                if (value != _Rank)
                {
                    _Rank = value;
                    OnPropertyChanged("Rank");
                }
            }
        }

        public Dictionary<string, int> RecNamesAndScore
        {
            get
            {
                return _RecNamesAndScore;
            }
            set
            {
                if (value != _RecNamesAndScore)
                {
                    _RecNamesAndScore = value;
                    OnPropertyChanged("RecNamesAndScore");
                }
            }
        }

        public int Sources
        {
            get
            {
                return _Sources;
            }
            set
            {
                if (value != _Sources)
                {
                    _Sources = value;
                    OnPropertyChanged("Sources");
                }
            }
        }

        public String Uri
        {
            get
            {
                return _Uri;
            }
            set
            {
                if (value != _Uri)
                {
                    _Uri = value;
                    OnPropertyChanged("Uri");
                }
            }
        }

        public int Votes
        {
            get
            {
                return _Votes;
            }
            set
            {
                if (value != _Votes)
                {
                    _Votes = value;
                    OnPropertyChanged("Votes");
                }
            }
        }
    }
}